﻿social_network_model = 
{
    tcls_zone_id_to_lol_zone_id_map = {};
    group_tab_reddot_status = false;    -- 消息tab红点状态
    msg_tab_has_clicked_and_no_new_msg_from_server_ = false;
    user_online_setting = nil;

    init = function()
         base_utility.log("[social_network_model] init");

        social_network_model.tcls_zone_id_to_lol_zone_id_map[257] = 1;
        social_network_model.tcls_zone_id_to_lol_zone_id_map[258] = 2;
        social_network_model.tcls_zone_id_to_lol_zone_id_map[513] = 3;
        social_network_model.tcls_zone_id_to_lol_zone_id_map[769] = 4;
        social_network_model.tcls_zone_id_to_lol_zone_id_map[1025] = 5;
        social_network_model.tcls_zone_id_to_lol_zone_id_map[514] = 6;
        social_network_model.tcls_zone_id_to_lol_zone_id_map[1281] = 7;
        social_network_model.tcls_zone_id_to_lol_zone_id_map[1537] = 8;
        social_network_model.tcls_zone_id_to_lol_zone_id_map[770] = 9;
        social_network_model.tcls_zone_id_to_lol_zone_id_map[1793] = 10;
        social_network_model.tcls_zone_id_to_lol_zone_id_map[2049] = 11;
        social_network_model.tcls_zone_id_to_lol_zone_id_map[1026] = 12;
        social_network_model.tcls_zone_id_to_lol_zone_id_map[2305] = 13;
        social_network_model.tcls_zone_id_to_lol_zone_id_map[2561] = 14;
        social_network_model.tcls_zone_id_to_lol_zone_id_map[2817] = 15;
        social_network_model.tcls_zone_id_to_lol_zone_id_map[1282] = 16;
        social_network_model.tcls_zone_id_to_lol_zone_id_map[3073] = 17;
        social_network_model.tcls_zone_id_to_lol_zone_id_map[3329] = 18;
        social_network_model.tcls_zone_id_to_lol_zone_id_map[3585] = 19;
        social_network_model.tcls_zone_id_to_lol_zone_id_map[1538] = 20;
        social_network_model.tcls_zone_id_to_lol_zone_id_map[65539] = 21;
        social_network_model.tcls_zone_id_to_lol_zone_id_map[3841] = 22;
        social_network_model.tcls_zone_id_to_lol_zone_id_map[4097] = 23;
        social_network_model.tcls_zone_id_to_lol_zone_id_map[4353] = 24;
        social_network_model.tcls_zone_id_to_lol_zone_id_map[4609] = 25;
        social_network_model.tcls_zone_id_to_lol_zone_id_map[1794] = 26;
        social_network_model.tcls_zone_id_to_lol_zone_id_map[4865] = 27;

    end;

    lol_zone_id_from_tcls_zone_id = function(tcls_zone_id)
        local zone_id = 0;
        if social_network_model.tcls_zone_id_to_lol_zone_id_map[tcls_zone_id] ~= nil then
            zone_id = social_network_model.tcls_zone_id_to_lol_zone_id_map[tcls_zone_id];
        end
        return zone_id;
    end;

    tcls_zoen_id_from_lol_zone_id = function(lol_zone_id)
        local tcls_id = 0;
        for key, value in pairs(social_network_model.tcls_zone_id_to_lol_zone_id_map) do
            if lol_zone_id == value then
                tcls_id = key;
            end
        end
        return tcls_id;
    end;

    get_lol_zone_id = function()
        local tgp_zoen_id = 0;
        local tcls_zone_id = 0;
        local game_lib =
            base_utility.get_component_adapter("IGame_library",
                "ierd_tgp.game_library.Get_game_library_adapter();");
        if game_lib ~= nil then
            local lol_game_servers = ierd_tgp.game_library.GameServers:new();
            if game_lib:get_game_servers_info(26, lol_game_servers) == true then
                tcls_zone_id = lol_game_servers.selleted;
            end
            lol_game_servers:delete();
        end
        base_utility.log("[social_network_model] get_lol_zone_id tcls zone id is:"..tostring(tcls_zone_id), true);

        if tcls_zone_id > 0 then
            tgp_zoen_id = social_network_model.lol_zone_id_from_tcls_zone_id(tcls_zone_id);
        end

        base_utility.log("[social_network_model] get_lol_zone_id tgp zone id is:"..tostring(tgp_zoen_id), true);
        return tgp_zoen_id;
    end;

    lol_game_zone = {
        LoadStr("SOCIAL_TALK_DIALOG_LOL_ZONE_1"),
        LoadStr("SOCIAL_TALK_DIALOG_LOL_ZONE_2"),
        LoadStr("SOCIAL_TALK_DIALOG_LOL_ZONE_3"),
        LoadStr("SOCIAL_TALK_DIALOG_LOL_ZONE_4"),
        LoadStr("SOCIAL_TALK_DIALOG_LOL_ZONE_5"),
        LoadStr("SOCIAL_TALK_DIALOG_LOL_ZONE_6"),
        LoadStr("SOCIAL_TALK_DIALOG_LOL_ZONE_7"),
        LoadStr("SOCIAL_TALK_DIALOG_LOL_ZONE_8"),
        LoadStr("SOCIAL_TALK_DIALOG_LOL_ZONE_9"),
        LoadStr("SOCIAL_TALK_DIALOG_LOL_ZONE_10"),
        LoadStr("SOCIAL_TALK_DIALOG_LOL_ZONE_11"),
        LoadStr("SOCIAL_TALK_DIALOG_LOL_ZONE_12"),
        LoadStr("SOCIAL_TALK_DIALOG_LOL_ZONE_13"),
        LoadStr("SOCIAL_TALK_DIALOG_LOL_ZONE_14"),
        LoadStr("SOCIAL_TALK_DIALOG_LOL_ZONE_15"),
        LoadStr("SOCIAL_TALK_DIALOG_LOL_ZONE_16"),
        LoadStr("SOCIAL_TALK_DIALOG_LOL_ZONE_17"),
        LoadStr("SOCIAL_TALK_DIALOG_LOL_ZONE_18"),
        LoadStr("SOCIAL_TALK_DIALOG_LOL_ZONE_19"),
        LoadStr("SOCIAL_TALK_DIALOG_LOL_ZONE_20"),
        LoadStr("SOCIAL_TALK_DIALOG_LOL_ZONE_21"),
        LoadStr("SOCIAL_TALK_DIALOG_LOL_ZONE_22"),
        LoadStr("SOCIAL_TALK_DIALOG_LOL_ZONE_23"),
        LoadStr("SOCIAL_TALK_DIALOG_LOL_ZONE_24"),
        LoadStr("SOCIAL_TALK_DIALOG_LOL_ZONE_25"),
        LoadStr("SOCIAL_TALK_DIALOG_LOL_ZONE_26"),
        LoadStr("SOCIAL_TALK_DIALOG_LOL_ZONE_27")
    };

    get_gzone_name = function(gzone_id)
        return social_network_model.lol_game_zone[gzone_id]
    end;

    get_lol_all_id_to_name = function()
        local param = {};
        for i = 1, #social_network_model.lol_game_zone do
            table.insert(param, {zone_id = i, zone_name = social_network_model.lol_game_zone[i]});
        end
        return param;
    end;

    get_tgp_level = function ()
        local out_data = comm_center.call_service("i_service_personal_center_get_self_info", {});
        if out_data == nil or out_data.level == nil then
            base_utility.log("[social_network_model] i_service_personal_center_get_self_info get level empty!!", true);
            return 0;
        end;
        return out_data.level;
    end;
};

social_network_model.init();